package com.example.administrator.yuejian2.activity;


import android.os.Bundle;

import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.administrator.yuejian2.R;
import com.example.administrator.yuejian2.adapter.RecyclerAdapter;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyFragment extends Fragment {


    public MyFragment() {
        // Required empty public constructor
    }
    private String Title;   //可以根据这个修改item里面的内容
    private RecyclerView recyclerView;
    public void setTitle(String title) {
        Title = title;
    }

    @Override

    public View onCreateView(LayoutInflater inflater, ViewGroup container,  Bundle savedInstanceState) {
        //拿到fragment的view，之后实例化recyclerView，然后创建适配器，再挂上recyclerView
        View view =inflater.inflate(R.layout.fragment_my,container,false);
        recyclerView=view.findViewById(R.id.recyclerView_my);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        RecyclerAdapter recyclerAdapter=new RecyclerAdapter(getActivity());
        recyclerView.setAdapter(recyclerAdapter);
        return view;
    }



}
